package _10综合案例_斗地主发牌;

import java.util.ArrayList;
import java.util.Collections;

public class Demo {
    public static void main(String[] args) {
        ArrayList<String> poker = getPoker();
        Collections.shuffle(poker);

        ArrayList<String> playerA =new ArrayList<>();
        ArrayList<String> playerB =new ArrayList<>();
        ArrayList<String> playerC =new ArrayList<>();
        ArrayList<String> dipai =new ArrayList<>();

        for (int i = 0; i < 17; i++) {
            playerA.add(poker.get(0));
            poker.remove(0);
            playerB.add(poker.get(0));
            poker.remove(0);
            playerC.add(poker.get(0));
            poker.remove(0);
        }

        dipai = poker;
        System.out.println(playerA);
        System.out.println(playerB);
        System.out.println(playerC);
        System.out.println(dipai);

    }

    public static ArrayList<String> getPoker(){
        ArrayList<String> poker = new ArrayList<>();

        poker.add("大☠") ;
        poker.add("小☠") ;

        //循环加入纸牌
        //花色数组
        String[] colors = {"♠","♥","♣","♦"};
        //牌号数组
        String[] numbers = {"2","A","K","Q","J","10","9","8","7","6","5","4","3"};

        for (int i = 0; i < colors.length; i++) {
            for (int j = 0; j < numbers.length; j++) {
                poker.add(colors[i]+numbers[j]);
            }
        }
        return poker;

    }


}
